<ui:composition
  xmlns="http://www.w3.org/1999/xhtml"
  xmlns:ui="http://java.sun.com/jsf/facelets"
  xmlns:c="http://java.sun.com/jstl/core"
  xmlns:h="http://java.sun.com/jsf/html"
  xmlns:a4j="http://richfaces.org/a4j"
  xmlns:nxh="http://nuxeo.org/nxweb/html">

  <a4j:outputPanel id="facesStatusMessagePanel" ajaxRendered="true" layout="block">

    <div class="facesStatusMessage">
      <c:if test="#{facesContext.maximumSeverity.ordinal >= 2}">
        <h:outputScript target="#{pageJsTarget}">
          jQuery(document).ready(function() {
            jQuery.ambiance({
              title: nuxeo.utils.escapeHTML("#{messages['feedback.correctErrors']}"),
              type: "error",
              className: "errorFeedback",
              timeout: 0
            })
          });
        </h:outputScript>
      </c:if>
      <h:outputScript target="#{pageJsTarget}">
      //<![CDATA[
        jsf.ajax.addOnError(function(data) {
          if (data.status == 'httpError' && data.responseCode === 0) {
              var disabled = #{configurationService.isBooleanPropertyTrue('nuxeo.jsf.ajax.disableErrorFeedback')};
              if (!disabled){
                jQuery.ambiance({
                  title: nuxeo.utils.escapeHTML("#{messages['feedback.ajax.emptyResponse']}"),
                  type: "error",
                  className: "warningFeedback",
                  timeout: 1
                });
              }
            } else {
              jQuery.ambiance({
                title: nuxeo.utils.escapeHTML(data.description),
                type: "error",
                className: "errorFeedback",
                timeout: 0
              });
            }
        });
      //]]>
      </h:outputScript>
    </div>

    <nxh:messages globalOnly="true" target="#{pageJsTarget}"
      infoClass="infoFeedback"
      warnClass="warningFeedback"
      errorClass="errorFeedback" />

  </a4j:outputPanel>

</ui:composition>